import request from '@/utils/request'
import type { ResultList, BaseInfo } from '@/@types/index.type'

export interface Menu extends BaseInfo {
  menuId?: number
  menuName?: string
  parentId?: number
  permission?: string
  route?: string
  component?: string
  icon?: string
  visible?: '0' | '1'
  menuType?: 0 | 1 | 2 
}

export const addMenu = (data: any) => request.post('/system/menu', data)

export const deleteMenu = (id: number) => request.delete('/system/menu/' + id)

export const updateMenu = (id: number, data: any) => request.put('/system/menu/' + id, data)

export const getMenuList = (data?: any) => request.get<Menu[]>('/system/menu', data)

export const getMenu = (id: number) => request.get<Menu>('/system/menu/' + id)
